Integrand size = 23, antiderivative size = 87 \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\left (a^2 A-A b^2-2 a b B\right ) x-\frac {\left (2 a A b+a^2 B-b^2 B\right ) \log (\cos (c+d x))}{d}+\frac {b (A b+a B) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d} \]
[Out]
Time = 0.09 (sec) , antiderivative size = 87, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {3609, 3606, 3556} \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-\frac {\left (a^2 B+2 a A b-b^2 B\right ) \log (\cos (c+d x))}{d}+x \left (a^2 A-2 a b B-A b^2\right )+\frac {b (a B+A b) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d} \]
[In]
[Out]
Rule 3556
Rule 3606
Rule 3609
Rubi steps \begin{align*} \text {integral}& = \frac {B (a+b \tan (c+d x))^2}{2 d}+\int (a+b \tan (c+d x)) (a A-b B+(A b+a B) \tan (c+d x)) \, dx \\ & = \left (a^2 A-A b^2-2 a b B\right ) x+\frac {b (A b+a B) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d}+\left (2 a A b+a^2 B-b^2 B\right ) \int \tan (c+d x) \, dx \\ & = \left (a^2 A-A b^2-2 a b B\right ) x-\frac {\left (2 a A b+a^2 B-b^2 B\right ) \log (\cos (c+d x))}{d}+\frac {b (A b+a B) \tan (c+d x)}{d}+\frac {B (a+b \tan (c+d x))^2}{2 d} \\ \end{align*}
Result contains complex when optimal does not.
Time = 0.48 (sec) , antiderivative size = 96, normalized size of antiderivative = 1.10 \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {(a+i b)^2 (-i A+B) \log (i-\tan (c+d x))+(a-i b)^2 (i A+B) \log (i+\tan (c+d x))+2 b (A b+2 a B) \tan (c+d x)+b^2 B \tan ^2(c+d x)}{2 d} \]
[In]
[Out]
Time = 0.04 (sec) , antiderivative size = 90, normalized size of antiderivative = 1.03
method | result | size |
norman | \(\left (A \,a^{2}-A \,b^{2}-2 B a b \right ) x +\frac {b \left (A b +2 B a \right ) \tan \left (d x +c \right )}{d}+\frac {B \,b^{2} \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {\left (2 A a b +B \,a^{2}-B \,b^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) | \(90\) |
derivativedivides | \(\frac {\frac {B \,b^{2} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+A \,b^{2} \tan \left (d x +c \right )+2 B a b \tan \left (d x +c \right )+\frac {\left (2 A a b +B \,a^{2}-B \,b^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (A \,a^{2}-A \,b^{2}-2 B a b \right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(97\) |
default | \(\frac {\frac {B \,b^{2} \left (\tan ^{2}\left (d x +c \right )\right )}{2}+A \,b^{2} \tan \left (d x +c \right )+2 B a b \tan \left (d x +c \right )+\frac {\left (2 A a b +B \,a^{2}-B \,b^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (A \,a^{2}-A \,b^{2}-2 B a b \right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(97\) |
parts | \(A \,a^{2} x +\frac {\left (A \,b^{2}+2 B a b \right ) \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {\left (2 A a b +B \,a^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {B \,b^{2} \left (\frac {\left (\tan ^{2}\left (d x +c \right )\right )}{2}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}\right )}{d}\) | \(98\) |
parallelrisch | \(\frac {2 A x \,a^{2} d -2 A \,b^{2} d x -4 B a b d x +B \,b^{2} \left (\tan ^{2}\left (d x +c \right )\right )+2 A \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a b +2 A \,b^{2} \tan \left (d x +c \right )+B \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{2}-B \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) b^{2}+4 B a b \tan \left (d x +c \right )}{2 d}\) | \(115\) |
risch | \(\frac {4 i A a b c}{d}-\frac {2 i B \,b^{2} c}{d}+\frac {2 i a^{2} B c}{d}+A \,a^{2} x -A \,b^{2} x -2 B a b x +\frac {2 i b \left (A b \,{\mathrm e}^{2 i \left (d x +c \right )}+2 B a \,{\mathrm e}^{2 i \left (d x +c \right )}-i B b \,{\mathrm e}^{2 i \left (d x +c \right )}+A b +2 B a \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-i B \,b^{2} x +2 i A a b x +i B \,a^{2} x -\frac {2 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A a b}{d}-\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B \,b^{2}}{d}\) | \(204\) |
[In]
[Out]
none
Time = 0.24 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.05 \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {B b^{2} \tan \left (d x + c\right )^{2} + 2 \, {\left (A a^{2} - 2 \, B a b - A b^{2}\right )} d x - {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 2 \, {\left (2 \, B a b + A b^{2}\right )} \tan \left (d x + c\right )}{2 \, d} \]
[In]
[Out]
Time = 0.10 (sec) , antiderivative size = 143, normalized size of antiderivative = 1.64 \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\begin {cases} A a^{2} x + \frac {A a b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} - A b^{2} x + \frac {A b^{2} \tan {\left (c + d x \right )}}{d} + \frac {B a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - 2 B a b x + \frac {2 B a b \tan {\left (c + d x \right )}}{d} - \frac {B b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {B b^{2} \tan ^{2}{\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (A + B \tan {\left (c \right )}\right ) \left (a + b \tan {\left (c \right )}\right )^{2} & \text {otherwise} \end {cases} \]
[In]
[Out]
none
Time = 0.38 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.05 \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {B b^{2} \tan \left (d x + c\right )^{2} + 2 \, {\left (A a^{2} - 2 \, B a b - A b^{2}\right )} {\left (d x + c\right )} + {\left (B a^{2} + 2 \, A a b - B b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, {\left (2 \, B a b + A b^{2}\right )} \tan \left (d x + c\right )}{2 \, d} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 811 vs. \(2 (85) = 170\).
Time = 0.70 (sec) , antiderivative size = 811, normalized size of antiderivative = 9.32 \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\text {Too large to display} \]
[In]
[Out]
Time = 8.35 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.05 \[ \int (a+b \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (\frac {B\,a^2}{2}+A\,a\,b-\frac {B\,b^2}{2}\right )}{d}-x\,\left (-A\,a^2+2\,B\,a\,b+A\,b^2\right )+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (A\,b^2+2\,B\,a\,b\right )}{d}+\frac {B\,b^2\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2\,d} \]
[In]
[Out]